Fix: deal with bigint types in objects stored as jsonb#2947
Fix: deal with bigint types in objects stored as jsonb#2947ales-albert-kilbergr wants to merge 1 commit intobrianc:masterfrom
Conversation
Currently a pg library fails when processing objects for jsonb columns which contains bigints because JSON.stringify by default does not know how to deal with it.
|
This introduces overhead to every JSON encoding in order to accommodate one specific type. I would suggest moving the Also, I wouldn’t expect |
A big int can exceed a range for number in javascript therefor there is not much other options how to serialize it in JSON than a string currently.
That would be a good option.
BigInt is standartized javascript primitive type. Why shouldn`t be possible to pass it as a property for JSONB object? |
For the reasons I mentioned. To expand on the second one: it doesn’t survive the round trip through |
The pg library fails to serialize query values in case when an object for jsonb column contains bigint.
The failed error message is as follows because JSON.stringify does not know how to deal with bigint.
Reproducible example could look like this: